

**** Descriptives of sample
preserve 
	use "Dataset_without_list.dta", clear
	keep if Progress==100
	tab Q4 
	tab Q7 
	tab Q8 
	tab Q8_6_TEXT 
	tab Q10 
	tab Q1786
restore

**** Data for significance test between scale scores over time
// Equations: https://www.real-statistics.com/students-t-distribution/two-sample-t-test-uequal-variances/
// Howell, D. C. (2010) Statistical methods for psychology (7th ed.). Wadsworth, Cengage Learning.
// https://labs.la.utexas.edu/gilden/files/2016/05/Statistics-Text.pdf
clear
global scales d_eaglyagen d_eaglycomp d_communal dk_com dk_lea dk_emp dk_int 
global groups fempol allpol malpol
gen scale = ""
gen group = ""
gen mean2011 = .
gen mean2021 = .
gen se2011 = .
gen se2021 = .
gen t = .
gen df = .

local count = 0
foreach scale of global scales {
	di "`scale'"
	foreach group of global groups {
		local count = `count' + 1
		di `count'
		set obs `count'
		di `count'
		preserve
			use "originalscalescores_US.dta", clear
			qui sum o_`group'_us_std if trait=="`scale'"
			local x1 = r(mean)
			qui sum o_se_`group'_us_std if trait=="`scale'"	
			local se1 = r(mean)
			qui sum o_n_`group'_us if trait=="`scale'"	
			local n1 = r(mean)
			local sd1 = `se1' * (`n1'^.5)
			use "listscalescores_US.dta", clear
			qui sum l_`group'_us_std if trait=="`scale'"
			local x2 = r(mean)
			qui sum lse_`group'_us_std if trait=="`scale'"	
			local se2 = r(mean)
			local n2 = 1200
			local sd2 = `se2' * (`n2'^.5)
			local t = (`x1' - `x2') / (((`se1'^2) + (`se2'^2))^.5)
			local df = (`sd1'^2/`n1' + `sd2'^2/`n2')^2 / (((`sd1'^2/`n1')^2/(`n1'-1)) + ((`sd2'^2/`n2')^2/(`n2'-1))) 
		restore
		qui replace scale = "`scale'" in `count'
		qui replace group = "`group'" in `count'
		qui replace mean2011 = `x1' in `count'
		qui replace mean2021 = `x2' in `count'
		qui replace se2011 = `se1' in `count'
		qui replace se2021 = `se2' in `count'
		qui replace t = `t' in `count'
		qui replace df = int(`df') in `count'
	}
}
gen p = ttail(df,abs(t))*2 // two-tailed test, can be compared to 0.05
format mean* se* t p %4.3f

qui replace group = "Women politicians" if group=="fempol"
qui replace group = "Politicians" if group=="allpol"
qui replace group = "Men politicians" if group=="malpol"
qui replace scale = "Agency" if scale=="d_eaglyagen"
qui replace scale = "Competence" if scale=="d_eaglycomp" 
qui replace scale = "Communality" if scale=="d_communal"
qui replace scale = "Leader competence" if scale=="dk_com"
qui replace scale = "Strong leadership" if scale=="dk_lea"
qui replace scale = "Empathy" if scale=="dk_emp"
qui replace scale = "Integrity" if scale=="dk_int"


****** Standardized scores in visualization
* focus on over time comparison

preserve
	use "originalscalescores_US.dta", clear
	merge 1:1 trait using "listscalescores_US.dta", nogen
	
	foreach var of varlist o* l* {
		local tempname = regexr("`var'","_us","") 
		rename `var' `tempname'
	}
	
	forval i = 1/20 {
		gen x`i' = -`i'
	}
	
	* Agentic commnunal, with confidence intervals
	global d_eaglyagen Agency
	global d_eaglycomp Competence
	global d_communal Communality
	global d_eaglyagen_traits `" "Active, Aggressive, Ambitious, Arrogant, Assertive" "Confident, Daring, Determined, Dominant, Driven" "Hard working, Independent, Selfish, Strong, Strong-willed"  "'
	global d_eaglycomp_traits `" "Creative, Intelligent, Logical" "Organized, Smart, Knowledgeable"  "'
	global d_communal_traits `" "Affectionate, Caring, Compassionate, Emotional, In touch with" "people, Gentle, Loving, Really cares about, people like me," "Sensitive, Sympathetic, Warm" "'

	* create a blank graph
	twoway scatteri 1 1, msymbol(i) ylab("") xlab("") ytitle("") xtitle("") yscale(off) xscale(off) plotregion(lpattern(blank)) name(blank, replace) scheme(tufte)
	
	foreach scale of newlist d_eaglyagen d_eaglycomp d_communal {
		twoway (rspike olb_malpol_std oub_malpol_std x1  if trait=="`scale'", lw(thin) hor) ///
			   (rspike llb_malpol_std lub_malpol_std x2  if trait=="`scale'", lw(thin) hor) ///
			   (rspike olb_allpol_std oub_allpol_std x4  if trait=="`scale'", lw(thin) hor) /// 
			   (rspike llb_allpol_std lub_allpol_std x5  if trait=="`scale'", lw(thin) hor) /// 
			   (rspike olb_fempol_std oub_fempol_std x7  if trait=="`scale'", lw(thin) hor) ///
			   (rspike llb_fempol_std lub_fempol_std x8  if trait=="`scale'", lw(thin) hor) ///
			   (scatter x1  o_malpol_std if trait=="`scale'", mlab(o_fempol_std) mlabg(*8 ) msize(small) m(Oh) mcol(ebblue)) ///
			   (scatter x2  l_malpol_std if trait=="`scale'", mlab(l_fempol_std) mlabg(*11) msize(small) m(O) mcol(ebblue)) ///
			   (scatter x4  o_allpol_std if trait=="`scale'", mlab(o_allpol_std) mlabg(*8 ) msize(small) m(Th) mcol(orange)) ///
			   (scatter x5  l_allpol_std if trait=="`scale'", mlab(l_allpol_std) mlabg(*10) msize(small) m(T) mcol(orange)) ///
			   (scatter x7  o_fempol_std if trait=="`scale'", mlab(o_malpol_std) mlabg(*7 ) msize(small) m(Sh) mcol(red)) ///
			   (scatter x8  l_fempol_std if trait=="`scale'", mlab(l_malpol_std) mlabg(*11) msize(small) m(S) mcol(red)) ///
			   , legend(order(7 "Men politicians, 2011" 8 "Men politicians, 2021" 9 "Politicians, 2011" 10 "Politicians, 2021" 11 "Women politicians, 2011" 12 "Women politicians, 2021") cols(2) size(vsmall)) ylabel(-1 " " -2 " " -4 " " -5 " " -7 " " -8 " ", noticks)	xscale(range(-1.5 1.5)) yscale(range(-9 0) noli) xlabel(-1 "-1" 0 "0" 1 "1", labsize(vsmall)) title($`scale', size(medsmall)) name(`scale', replace) subtitle($`scale'_traits, size(vsmall)) scheme(tufte)
	}
	
	grc1leg d_eaglyagen d_eaglycomp blank d_communal blank , xcommon pos(7) name(figure1, replace)	 
	
	* Leadership, with confidence intervals
	global dk_com "Leader competence"
	global dk_lea "Strong leadership"
	global dk_emp Empathy
	global dk_int Integrity
	global dk_com_traits `" "Analytical, Educated, Gets things done, Good with numbers," "Hard-working, Intelligent, Knowledgeable, Organized," "Rational, Smart, Well-educated, Well-spoken" "'
	global dk_lea_traits `" "Ambitious, Assertive, Charismatic, Commands respect, Competitive," "Confident, Determined, Dominant, Hard nosed, Independent," "Inspiring, Leader, Power hungry, Powerful, Strong willed, Tough" "'
	global dk_emp_traits `" "Affectionate, Caring, Compassionate, Gentle, Loving," "Really cares about people like me, Sympathetic, Warm" "'
	global dk_int_traits `" "Decent, Ethical, Honest, Moral" "'

	* create a blank graph
	twoway scatteri 1 1, msymbol(i) ylab("") xlab("") ytitle("") xtitle("") yscale(off) xscale(off) plotregion(lpattern(blank)) name(blank, replace) scheme(tufte)

	foreach scale of newlist dk_com dk_lea dk_emp dk_int {
		twoway (rspike olb_malpol_std oub_malpol_std x1  if trait=="`scale'", lw(thin) hor) ///
			   (rspike llb_malpol_std lub_malpol_std x2  if trait=="`scale'", lw(thin) hor) ///
			   (rspike olb_allpol_std oub_allpol_std x4  if trait=="`scale'", lw(thin) hor) /// 
			   (rspike llb_allpol_std lub_allpol_std x5  if trait=="`scale'", lw(thin) hor) /// 
			   (rspike olb_fempol_std oub_fempol_std x7  if trait=="`scale'", lw(thin) hor) ///
			   (rspike llb_fempol_std lub_fempol_std x8  if trait=="`scale'", lw(thin) hor) ///
			   (scatter x1  o_malpol_std if trait=="`scale'", mlab(o_malpol_std) mlabg(*6) msize(small) m(Oh) mcol(ebblue)) ///
			   (scatter x2  l_malpol_std if trait=="`scale'", mlab(l_malpol_std) mlabg(*13) msize(small) m(O) mcol(ebblue)) ///
			   (scatter x4  o_allpol_std if trait=="`scale'", mlab(o_allpol_std) mlabg(*6) msize(small) m(Th) mcol(orange)) ///
			   (scatter x5  l_allpol_std if trait=="`scale'", mlab(l_allpol_std) mlabg(*13) msize(small) m(T) mcol(orange)) ///
			   (scatter x7  o_fempol_std if trait=="`scale'", mlab(o_fempol_std) mlabg(*6) msize(small) m(Sh) mcol(red)) ///
			   (scatter x8  l_fempol_std if trait=="`scale'", mlab(l_fempol_std) mlabg(*14) msize(small) m(S) mcol(red)) ///
			   , legend(order(7 "Men politicians, 2011" 8 "Men politicians, 2021" 9 "Politicians, 2011" 10 "Politicians, 2021" 11 "Women politicians, 2011" 12 "Women politicians, 2021") cols(2) size(vsmall)) ylabel(-1 " " -2 " " -4 " " -5 " " -7 " " -8 " ", noticks)	xscale(range(-1.5 1.5)) yscale(range(-9 0) noli) xlabel(-1 "-1" 0 "0" 1 "1", labsize(vsmall)) title($`scale', size(medsmall)) name(`scale', replace) subtitle($`scale'_traits, size(vsmall)) scheme(tufte)
	}
	
	grc1leg dk_com dk_lea blank dk_emp dk_int blank, xcommon pos(7)	name(figure2, replace) 

		
restore




********** Additional Analyses and Robustness

*** Robustness analysis 1.
* Comparison including knowledge (replication) question
preserve
	use "originalscalescores_US.dta", clear
	foreach var of varlist o* {
		local tempname = regexr("`var'","_us","") 
		rename `var' `tempname'
	}
	forval i = 1/33 {
		gen x`i' = -`i'
	}
	twoway (rspike olb_malpol_std oub_malpol_std x1  if trait=="d_eaglyagen", hor) /// d_eaglyagen d_eaglycomp d_communal
		   (rspike olb_allpol_std oub_allpol_std x2  if trait=="d_eaglyagen", hor) /// 
		   (rspike olb_fempol_std oub_fempol_std x3  if trait=="d_eaglyagen", hor) ///
		   (rspike olb_malpol_std oub_malpol_std x6  if trait=="d_eaglycomp", hor) /// 
		   (rspike olb_allpol_std oub_allpol_std x7  if trait=="d_eaglycomp", hor) /// 
		   (rspike olb_fempol_std oub_fempol_std x8  if trait=="d_eaglycomp", hor) /// 
		   (rspike olb_malpol_std oub_malpol_std x11 if trait=="d_communal" , hor) /// 
		   (rspike olb_allpol_std oub_allpol_std x12 if trait=="d_communal" , hor) /// 
		   (rspike olb_fempol_std oub_fempol_std x13 if trait=="d_communal" , hor) /// 
		   (rspike olb_malpol_std oub_malpol_std x16 if trait=="dk_com", hor) ///
		   (rspike olb_allpol_std oub_allpol_std x17 if trait=="dk_com", hor) /// 
		   (rspike olb_fempol_std oub_fempol_std x18 if trait=="dk_com", hor) ///
		   (rspike olb_malpol_std oub_malpol_std x21 if trait=="dk_lea", hor) /// 
		   (rspike olb_allpol_std oub_allpol_std x22 if trait=="dk_lea", hor) /// 
		   (rspike olb_fempol_std oub_fempol_std x23 if trait=="dk_lea", hor) /// 
		   (rspike olb_malpol_std oub_malpol_std x26 if trait=="dk_emp", hor) /// 
		   (rspike olb_allpol_std oub_allpol_std x27 if trait=="dk_emp", hor) /// 
		   (rspike olb_fempol_std oub_fempol_std x28 if trait=="dk_emp", hor) /// 
		   (rspike olb_malpol_std oub_malpol_std x31 if trait=="dk_int", hor) /// 
		   (rspike olb_allpol_std oub_allpol_std x32 if trait=="dk_int", hor) /// 
		   (rspike olb_fempol_std oub_fempol_std x33 if trait=="dk_int", hor) /// 
		   (scatter x1  o_malpol_std if trait=="d_eaglyagen", mlab(o_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x2  o_allpol_std if trait=="d_eaglyagen", mlab(o_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x3  o_fempol_std if trait=="d_eaglyagen", mlab(o_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x6  o_malpol_std if trait=="d_eaglycomp", mlab(o_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x7  o_allpol_std if trait=="d_eaglycomp", mlab(o_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x8  o_fempol_std if trait=="d_eaglycomp", mlab(o_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x11 o_malpol_std if trait=="d_communal" , mlab(o_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x12 o_allpol_std if trait=="d_communal" , mlab(o_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x13 o_fempol_std if trait=="d_communal" , mlab(o_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
	       (scatter x16 o_malpol_std if trait=="dk_com", mlab(o_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x17 o_allpol_std if trait=="dk_com", mlab(o_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x18 o_fempol_std if trait=="dk_com", mlab(o_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x21 o_malpol_std if trait=="dk_lea", mlab(o_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x22 o_allpol_std if trait=="dk_lea", mlab(o_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x23 o_fempol_std if trait=="dk_lea", mlab(o_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x26 o_malpol_std if trait=="dk_emp", mlab(o_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x27 o_allpol_std if trait=="dk_emp", mlab(o_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x28 o_fempol_std if trait=="dk_emp", mlab(o_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x31 o_malpol_std if trait=="dk_int", mlab(o_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x32 o_allpol_std if trait=="dk_int", mlab(o_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x33 o_fempol_std if trait=="dk_int", mlab(o_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   , legend(order(22 "Men politicians" 23 "Politicians" 24 "Women politicians") size(vsmall)) ylabel(-1 " " -2 "               Agency" -3 " " -6 " " -7 "Competence" -8 " " -11 " " -12 "Communality"  -13 " " -16 " " -17 `" "Leader" "competence" "' -18 " " -21 " " -22 `" "Strong" "leadership" "' -23 " " -26 " " -27 "Empathy"  -28 " " -31 " " -32 "Integrity" -33 " ", noticks angle(0) labs(vsmall)) yscale(range(1 -34)) xscale(range(-1 1)) xlabel(-1(1)1, labsize(vsmall)) xline(0, lp(dash) lc(gs14)) title(original 2011) name(g2011a, replace) scheme(tufte)
restore

preserve
	use "listscalescores_US.dta", clear
	foreach var of varlist l* {
		local tempname = regexr("`var'","_us","") 
		rename `var' `tempname'
	}

	forval i = 1/33 {
		gen x`i' = -`i'
	}

	twoway (rspike llb_malpol_std lub_malpol_std x1  if trait=="d_eaglyagen", hor) /// d_eaglyagen d_eaglycomp d_communal
		   (rspike llb_allpol_std lub_allpol_std x2  if trait=="d_eaglyagen", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x3  if trait=="d_eaglyagen", hor) ///
		   (rspike llb_malpol_std lub_malpol_std x6  if trait=="d_eaglycomp", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x7  if trait=="d_eaglycomp", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x8  if trait=="d_eaglycomp", hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x11 if trait=="d_communal" , hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x12 if trait=="d_communal" , hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x13 if trait=="d_communal" , hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x16 if trait=="dk_com", hor) ///
		   (rspike llb_allpol_std lub_allpol_std x17 if trait=="dk_com", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x18 if trait=="dk_com", hor) ///
		   (rspike llb_malpol_std lub_malpol_std x21 if trait=="dk_lea", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x22 if trait=="dk_lea", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x23 if trait=="dk_lea", hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x26 if trait=="dk_emp", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x27 if trait=="dk_emp", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x28 if trait=="dk_emp", hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x31 if trait=="dk_int", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x32 if trait=="dk_int", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x33 if trait=="dk_int", hor) /// 
		   (scatter x1  l_malpol_std if trait=="d_eaglyagen", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x2  l_allpol_std if trait=="d_eaglyagen", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x3  l_fempol_std if trait=="d_eaglyagen", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x6  l_malpol_std if trait=="d_eaglycomp", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x7  l_allpol_std if trait=="d_eaglycomp", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x8  l_fempol_std if trait=="d_eaglycomp", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x11 l_malpol_std if trait=="d_communal" , mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x12 l_allpol_std if trait=="d_communal" , mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x13 l_fempol_std if trait=="d_communal" , mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
	       (scatter x16 l_malpol_std if trait=="dk_com", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x17 l_allpol_std if trait=="dk_com", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x18 l_fempol_std if trait=="dk_com", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x21 l_malpol_std if trait=="dk_lea", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x22 l_allpol_std if trait=="dk_lea", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x23 l_fempol_std if trait=="dk_lea", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x26 l_malpol_std if trait=="dk_emp", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x27 l_allpol_std if trait=="dk_emp", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x28 l_fempol_std if trait=="dk_emp", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x31 l_malpol_std if trait=="dk_int", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x32 l_allpol_std if trait=="dk_int", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x33 l_fempol_std if trait=="dk_int", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   , legend(order(22 "Men politicians" 23 "Politicians" 24 "Women politicians") size(vsmall)) ylabel(-1 " " -2 " " -3 " " -6 " " -7 " " -8 " " -11 " " -12 " "  -13 " " -16 " " -17 " " -18 " " -21 " " -22 " " -23 " " -26 " " -27 " " -28 " " -31 " " -32 " " -33 " ", noticks labs(vsmall)) yscale(range(1 -20)) xscale(range(-1 1)) xlabel(-1 0 1, labsize(vsmall)) xline(0, lp(dash) lc(gs14)) title(list 2021) name(g2021a, replace) scheme(tufte)
restore

preserve
	use "knowledgescalescores_US.dta", clear

	foreach var of varlist k* {
		local tempname = regexr("`var'","_us","") 
		rename `var' `tempname'
	}
	
	forval i = 1/33 {
		gen x`i' = -`i'
	}

	twoway (rspike klb_malpol_std kub_malpol_std x1  if trait=="d_eaglyagen", hor) /// d_eaglyagen d_eaglycomp d_communal
		   (rspike klb_allpol_std kub_allpol_std x2  if trait=="d_eaglyagen", hor) /// 
		   (rspike klb_fempol_std kub_fempol_std x3  if trait=="d_eaglyagen", hor) ///
		   (rspike klb_malpol_std kub_malpol_std x6  if trait=="d_eaglycomp", hor) /// 
		   (rspike klb_allpol_std kub_allpol_std x7  if trait=="d_eaglycomp", hor) /// 
		   (rspike klb_fempol_std kub_fempol_std x8  if trait=="d_eaglycomp", hor) /// 
		   (rspike klb_malpol_std kub_malpol_std x11 if trait=="d_communal" , hor) /// 
		   (rspike klb_allpol_std kub_allpol_std x12 if trait=="d_communal" , hor) /// 
		   (rspike klb_fempol_std kub_fempol_std x13 if trait=="d_communal" , hor) /// 
		   (rspike klb_malpol_std kub_malpol_std x16 if trait=="dk_com", hor) ///
		   (rspike klb_allpol_std kub_allpol_std x17 if trait=="dk_com", hor) /// 
		   (rspike klb_fempol_std kub_fempol_std x18 if trait=="dk_com", hor) ///
		   (rspike klb_malpol_std kub_malpol_std x21 if trait=="dk_lea", hor) /// 
		   (rspike klb_allpol_std kub_allpol_std x22 if trait=="dk_lea", hor) /// 
		   (rspike klb_fempol_std kub_fempol_std x23 if trait=="dk_lea", hor) /// 
		   (rspike klb_malpol_std kub_malpol_std x26 if trait=="dk_emp", hor) /// 
		   (rspike klb_allpol_std kub_allpol_std x27 if trait=="dk_emp", hor) /// 
		   (rspike klb_fempol_std kub_fempol_std x28 if trait=="dk_emp", hor) /// 
		   (rspike klb_malpol_std kub_malpol_std x31 if trait=="dk_int", hor) /// 
		   (rspike klb_allpol_std kub_allpol_std x32 if trait=="dk_int", hor) /// 
		   (rspike klb_fempol_std kub_fempol_std x33 if trait=="dk_int", hor) /// 
		   (scatter x1  k_malpol_std if trait=="d_eaglyagen", mlab(k_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x2  k_allpol_std if trait=="d_eaglyagen", mlab(k_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x3  k_fempol_std if trait=="d_eaglyagen", mlab(k_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x6  k_malpol_std if trait=="d_eaglycomp", mlab(k_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x7  k_allpol_std if trait=="d_eaglycomp", mlab(k_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x8  k_fempol_std if trait=="d_eaglycomp", mlab(k_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x11 k_malpol_std if trait=="d_communal" , mlab(k_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x12 k_allpol_std if trait=="d_communal" , mlab(k_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x13 k_fempol_std if trait=="d_communal" , mlab(k_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
	       (scatter x16 k_malpol_std if trait=="dk_com", mlab(k_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x17 k_allpol_std if trait=="dk_com", mlab(k_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x18 k_fempol_std if trait=="dk_com", mlab(k_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x21 k_malpol_std if trait=="dk_lea", mlab(k_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x22 k_allpol_std if trait=="dk_lea", mlab(k_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x23 k_fempol_std if trait=="dk_lea", mlab(k_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x26 k_malpol_std if trait=="dk_emp", mlab(k_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x27 k_allpol_std if trait=="dk_emp", mlab(k_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x28 k_fempol_std if trait=="dk_emp", mlab(k_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x31 k_malpol_std if trait=="dk_int", mlab(k_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x32 k_allpol_std if trait=="dk_int", mlab(k_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x33 k_fempol_std if trait=="dk_int", mlab(k_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   , legend(order(22 "Men politicians" 23 "Politicians" 24 "Women politicians") size(vsmall)) ylabel(-1 " " -2 " " -3 " " -6 " " -7 " " -8 " " -11 " " -12 " "  -13 " " -16 " " -17 " " -18 " " -21 " " -22 " " -23 " " -26 " " -27 " " -28 " " -31 " " -32 " " -33 " ", noticks labs(vsmall)) yscale(range(1 -20)) xscale(range(-1 1)) xlabel(-1(1)1, labsize(vsmall)) xline(0, lp(dash) lc(gs14)) title(replication 2021) name(g2021know, replace) scheme(tufte)
restore

grc1leg g2011a g2021know g2021a, ycommon xcommon pos(6) cols(3)

* Significance test between original 2011 measure and 2021 replication measure
clear
global scales d_eaglyagen d_eaglycomp d_communal dk_com dk_lea dk_emp dk_int 
global groups fempol allpol malpol
gen scale = ""
gen group = ""
gen mean2011 = .
gen mean2021 = .
gen se2011 = .
gen se2021 = .
gen t = .
gen df = .

local count = 0
foreach scale of global scales {
	di "`scale'"
	foreach group of global groups {
		local count = `count' + 1
		di `count'
		set obs `count'
		di `count'
		preserve
			use "originalscalescores_US.dta", clear
			qui sum o_`group'_us_std if trait=="`scale'"
			local x1 = r(mean)
			qui sum o_se_`group'_us_std if trait=="`scale'"	
			local se1 = r(mean)
			qui sum o_n_`group'_us if trait=="`scale'"	
			local n1 = r(mean)
			local sd1 = `se1' * (`n1'^.5)
			use "knowledgescalescores_US.dta", clear
			qui sum k_`group'_us_std if trait=="`scale'"
			local x2 = r(mean)
			qui sum k_se_`group'_us_std if trait=="`scale'"	
			local se2 = r(mean)
			qui sum k_n_`group'_us if trait=="`scale'"	
			local n2 = r(mean)
			local sd2 = `se2' * (`n2'^.5)
			local t = (`x1' - `x2') / (((`se1'^2) + (`se2'^2))^.5)
			local df = (`sd1'^2/`n1' + `sd2'^2/`n2')^2 / (((`sd1'^2/`n1')^2/(`n1'-1)) + ((`sd2'^2/`n2')^2/(`n2'-1))) 
		restore
		qui replace scale = "`scale'" in `count'
		qui replace group = "`group'" in `count'
		qui replace mean2011 = `x1' in `count'
		qui replace mean2021 = `x2' in `count'
		qui replace se2011 = `se1' in `count'
		qui replace se2021 = `se2' in `count'
		qui replace t = `t' in `count'
		qui replace df = int(`df') in `count'
	}
}
gen p = ttail(df,abs(t))*2 // two-tailed test, can be compared to 0.05
format mean* se* t p %4.3f

qui replace group = "Women politicians" if group=="fempol"
qui replace group = "Politicians" if group=="allpol"
qui replace group = "Men politicians" if group=="malpol"
qui replace scale = "Agency" if scale=="d_eaglyagen"
qui replace scale = "Competence" if scale=="d_eaglycomp" 
qui replace scale = "Communality" if scale=="d_communal"
qui replace scale = "Leader competence" if scale=="dk_com"
qui replace scale = "Strong leadership" if scale=="dk_lea"
qui replace scale = "Empathy" if scale=="dk_emp"
qui replace scale = "Integrity" if scale=="dk_int"









*** Additional analyses 1.
* Sub-group analysis by party identification of respondents
global dem "Democrat respondents"
global ind "Independent respondents"
global rep "Republican respondents"

foreach subgroup of newlist dem ind rep {
	use "listscalescores_US_`subgroup'.dta", clear
	foreach var of varlist l* {
		local tempname = regexr("`var'","_us","") 
		rename `var' `tempname'
	}
	forval i = 1/33 {
		gen x`i' = -`i'
	}
	twoway (rspike llb_malpol_std lub_malpol_std x1  if trait=="d_eaglyagen", hor) /// d_eaglyagen d_eaglycomp d_communal
		   (rspike llb_allpol_std lub_allpol_std x2  if trait=="d_eaglyagen", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x3  if trait=="d_eaglyagen", hor) ///
		   (rspike llb_malpol_std lub_malpol_std x6  if trait=="d_eaglycomp", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x7  if trait=="d_eaglycomp", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x8  if trait=="d_eaglycomp", hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x11 if trait=="d_communal" , hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x12 if trait=="d_communal" , hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x13 if trait=="d_communal" , hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x16 if trait=="dk_com", hor) ///
		   (rspike llb_allpol_std lub_allpol_std x17 if trait=="dk_com", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x18 if trait=="dk_com", hor) ///
		   (rspike llb_malpol_std lub_malpol_std x21 if trait=="dk_lea", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x22 if trait=="dk_lea", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x23 if trait=="dk_lea", hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x26 if trait=="dk_emp", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x27 if trait=="dk_emp", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x28 if trait=="dk_emp", hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x31 if trait=="dk_int", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x32 if trait=="dk_int", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x33 if trait=="dk_int", hor) /// 
		   (scatter x1  l_malpol_std if trait=="d_eaglyagen", mlab(l_malpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(O) mcol(ebblue)) ///
		   (scatter x2  l_allpol_std if trait=="d_eaglyagen", mlab(l_allpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(T) mcol(orange)) ///
		   (scatter x3  l_fempol_std if trait=="d_eaglyagen", mlab(l_fempol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(S) mcol(red)) ///
		   (scatter x6  l_malpol_std if trait=="d_eaglycomp", mlab(l_malpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(O) mcol(ebblue)) ///
		   (scatter x7  l_allpol_std if trait=="d_eaglycomp", mlab(l_allpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(T) mcol(orange)) ///
		   (scatter x8  l_fempol_std if trait=="d_eaglycomp", mlab(l_fempol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(S) mcol(red)) ///
		   (scatter x11 l_malpol_std if trait=="d_communal" , mlab(l_malpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(O) mcol(ebblue)) ///
		   (scatter x12 l_allpol_std if trait=="d_communal" , mlab(l_allpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(T) mcol(orange)) ///
		   (scatter x13 l_fempol_std if trait=="d_communal" , mlab(l_fempol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(S) mcol(red)) ///
	       (scatter x16 l_malpol_std if trait=="dk_com", mlab(l_malpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(O) mcol(ebblue)) ///
		   (scatter x17 l_allpol_std if trait=="dk_com", mlab(l_allpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(T) mcol(orange)) ///
		   (scatter x18 l_fempol_std if trait=="dk_com", mlab(l_fempol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(S) mcol(red)) ///
		   (scatter x21 l_malpol_std if trait=="dk_lea", mlab(l_malpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(O) mcol(ebblue)) ///
		   (scatter x22 l_allpol_std if trait=="dk_lea", mlab(l_allpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(T) mcol(orange)) ///
		   (scatter x23 l_fempol_std if trait=="dk_lea", mlab(l_fempol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(S) mcol(red)) ///
		   (scatter x26 l_malpol_std if trait=="dk_emp", mlab(l_malpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(O) mcol(ebblue)) ///
		   (scatter x27 l_allpol_std if trait=="dk_emp", mlab(l_allpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(T) mcol(orange)) ///
		   (scatter x28 l_fempol_std if trait=="dk_emp", mlab(l_fempol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(S) mcol(red)) ///
		   (scatter x31 l_malpol_std if trait=="dk_int", mlab(l_malpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(O) mcol(ebblue)) ///
		   (scatter x32 l_allpol_std if trait=="dk_int", mlab(l_allpol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(T) mcol(orange)) ///
		   (scatter x33 l_fempol_std if trait=="dk_int", mlab(l_fempol_std) mlabs(vsmall) mlabg(*6) msiz(vsmall) m(S) mcol(red)) ///
		   , legend(order(22 "Men politicians" 23 "Politicians" 24 "Women politicians") size(vsmall)) ylabel(-1 " " -2 "Agency" -3 " " -6 " " -7 "Competence" -8 " " -11 " " -12 "Communality"  -13 " " -16 " " -17 `" "Leader" "competence" "' -18 " " -21 " " -22 `" "Strong" "leadership" "' -23 " " -26 " " -27 "Empathy"  -28 " " -31 " " -32 "Integrity" -33 " ", noticks angle(0) labs(vsmall)) yscale(range(1 -33)) xscale(range(-1 1)) xlabel(-1 0 1, labsize(vsmall)) xline(0, lp(dash) lc(gs14)) title($`subgroup', size(medsmall)) name(`subgroup', replace) scheme(tufte)
}
 
grc1leg dem ind rep , ycommon xcommon pos(6) cols(3)

* Significance test between party identification groups
clear
global scales d_eaglyagen d_eaglycomp d_communal dk_com dk_lea dk_emp dk_int 
global groups fempol allpol malpol
gen scale = ""
gen group = ""
gen meandem = .
gen meanind = .
gen meanrep = .
gen sedem = .
gen seind = .
gen serep = .
gen tdemind = .
gen dfdemind = .
gen tdemrep = .
gen dfdemrep = .
gen tindrep = .
gen dfindrep = .

local count = 0
foreach scale of global scales {
	di "`scale'"
	foreach group of global groups {
		local count = `count' + 1
		di `count'
		set obs `count'
		di `count'
		preserve
			use "listscalescores_US_dem.dta", clear
			qui sum l_`group'_us_std if trait=="`scale'"
			local x1 = r(mean)
			qui sum lse_`group'_us_std if trait=="`scale'"	
			local se1 = r(mean)
			local n1 = 1200
			local sd1 = `se1' * (`n1'^.5)
			use "listscalescores_US_ind.dta", clear
			qui sum l_`group'_us_std if trait=="`scale'"
			local x2 = r(mean)
			qui sum lse_`group'_us_std if trait=="`scale'"	
			local se2 = r(mean)
			local n2 = 1200
			local sd2 = `se2' * (`n2'^.5)
			use "listscalescores_US_rep.dta", clear
			qui sum l_`group'_us_std if trait=="`scale'"
			local x3 = r(mean)
			qui sum lse_`group'_us_std if trait=="`scale'"	
			local se3 = r(mean)
			local n3 = 1200
			local sd3 = `se3' * (`n2'^.5)
			
			local tdemind = (`x1' - `x2') / (((`se1'^2) + (`se2'^2))^.5)
			local dfdemind = (`sd1'^2/`n1' + `sd2'^2/`n2')^2 / (((`sd1'^2/`n1')^2/(`n1'-1)) + ((`sd2'^2/`n2')^2/(`n2'-1))) 
			
			local tdemrep = (`x1' - `x3') / (((`se1'^2) + (`se3'^2))^.5)
			local dfdemrep = (`sd1'^2/`n1' + `sd3'^2/`n3')^2 / (((`sd1'^2/`n1')^2/(`n1'-1)) + ((`sd3'^2/`n3')^2/(`n3'-1))) 
			
			local tindrep = (`x2' - `x3') / (((`se2'^2) + (`se3'^2))^.5)
			local dfindrep = (`sd2'^2/`n2' + `sd3'^2/`n3')^2 / (((`sd2'^2/`n2')^2/(`n2'-1)) + ((`sd3'^2/`n3')^2/(`n3'-1))) 

		restore
		qui replace scale = "`scale'" in `count'
		qui replace group = "`group'" in `count'
		qui replace meandem = `x1' in `count'
		qui replace meanind = `x2' in `count'
		qui replace meanrep = `x3' in `count'
		qui replace sedem = `se1' in `count'
		qui replace seind = `se2' in `count'
		qui replace serep = `se3' in `count'
		qui replace tdemind = `tdemind' in `count'
		qui replace dfdemind = int(`dfdemind') in `count'
		qui replace tdemrep = `tdemrep' in `count'
		qui replace dfdemrep = int(`dfdemrep') in `count'
		qui replace tindrep = `tindrep' in `count'
		qui replace dfindrep = int(`dfindrep') in `count'
	}
}
gen pdemind = ttail(dfdemind,abs(tdemind))*2 // two-tailed test, can be compared to 0.05
gen pdemrep = ttail(dfdemrep,abs(tdemrep))*2 // two-tailed test, can be compared to 0.05
gen pindrep = ttail(dfindrep,abs(tindrep))*2 // two-tailed test, can be compared to 0.05
format mean* se* t* p* %3.2f
order scale group mean* se* *demind *demrep *indrep

qui replace group = "Women politicians" if group=="fempol"
qui replace group = "Politicians" if group=="allpol"
qui replace group = "Men politicians" if group=="malpol"
qui replace scale = "Agency" if scale=="d_eaglyagen"
qui replace scale = "Competence" if scale=="d_eaglycomp" 
qui replace scale = "Communality" if scale=="d_communal"
qui replace scale = "Leader competence" if scale=="dk_com"
qui replace scale = "Strong leadership" if scale=="dk_lea"
qui replace scale = "Empathy" if scale=="dk_emp"
qui replace scale = "Integrity" if scale=="dk_int"


*** Additional analysis 2.
* Sub-group analysis men and women respondents
preserve
	use "listscalescores_US_men.dta", clear
	foreach var of varlist l* {
		local tempname = regexr("`var'","_us","") 
		rename `var' `tempname'
	}

	forval i = 1/33 {
		gen x`i' = -`i'
	}

	twoway (rspike llb_malpol_std lub_malpol_std x1  if trait=="d_eaglyagen", hor) /// d_eaglyagen d_eaglycomp d_communal
		   (rspike llb_allpol_std lub_allpol_std x2  if trait=="d_eaglyagen", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x3  if trait=="d_eaglyagen", hor) ///
		   (rspike llb_malpol_std lub_malpol_std x6  if trait=="d_eaglycomp", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x7  if trait=="d_eaglycomp", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x8  if trait=="d_eaglycomp", hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x11 if trait=="d_communal" , hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x12 if trait=="d_communal" , hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x13 if trait=="d_communal" , hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x16 if trait=="dk_com", hor) ///
		   (rspike llb_allpol_std lub_allpol_std x17 if trait=="dk_com", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x18 if trait=="dk_com", hor) ///
		   (rspike llb_malpol_std lub_malpol_std x21 if trait=="dk_lea", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x22 if trait=="dk_lea", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x23 if trait=="dk_lea", hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x26 if trait=="dk_emp", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x27 if trait=="dk_emp", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x28 if trait=="dk_emp", hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x31 if trait=="dk_int", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x32 if trait=="dk_int", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x33 if trait=="dk_int", hor) /// 
		   (scatter x1  l_malpol_std if trait=="d_eaglyagen", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x2  l_allpol_std if trait=="d_eaglyagen", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x3  l_fempol_std if trait=="d_eaglyagen", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x6  l_malpol_std if trait=="d_eaglycomp", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x7  l_allpol_std if trait=="d_eaglycomp", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x8  l_fempol_std if trait=="d_eaglycomp", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x11 l_malpol_std if trait=="d_communal" , mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x12 l_allpol_std if trait=="d_communal" , mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x13 l_fempol_std if trait=="d_communal" , mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
	       (scatter x16 l_malpol_std if trait=="dk_com", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x17 l_allpol_std if trait=="dk_com", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x18 l_fempol_std if trait=="dk_com", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x21 l_malpol_std if trait=="dk_lea", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x22 l_allpol_std if trait=="dk_lea", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x23 l_fempol_std if trait=="dk_lea", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x26 l_malpol_std if trait=="dk_emp", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x27 l_allpol_std if trait=="dk_emp", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x28 l_fempol_std if trait=="dk_emp", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x31 l_malpol_std if trait=="dk_int", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x32 l_allpol_std if trait=="dk_int", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x33 l_fempol_std if trait=="dk_int", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   , legend(order(22 "Men politicians" 23 "Politicians" 24 "Women politicians") size(vsmall)) ylabel(-1 " " -2 "                                             Agency" -3 " " -6 " " -7 "Competence" -8 " " -11 " " -12 "Communality"  -13 " " -16 " " -17 `" "Leader" "competence" "' -18 " " -21 " " -22 `" "Strong" "leadership" "' -23 " " -26 " " -27 "Empathy"  -28 " " -31 " " -32 "Integrity" -33 " ", noticks angle(0) labs(vsmall)) yscale(range(1 -33)) xscale(range(-1 1)) xlabel(-1 0 1, labsize(vsmall)) xline(0, lp(dash) lc(gs14)) title(Men respondents only) name(men, replace) scheme(tufte)
restore
 
preserve
	use "listscalescores_US_women.dta", clear
	foreach var of varlist l* {
		local tempname = regexr("`var'","_us","") 
		rename `var' `tempname'
	}
	forval i = 1/33 {
		gen x`i' = -`i'
	}
	twoway (rspike llb_malpol_std lub_malpol_std x1  if trait=="d_eaglyagen", hor) /// d_eaglyagen d_eaglycomp d_communal
		   (rspike llb_allpol_std lub_allpol_std x2  if trait=="d_eaglyagen", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x3  if trait=="d_eaglyagen", hor) ///
		   (rspike llb_malpol_std lub_malpol_std x6  if trait=="d_eaglycomp", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x7  if trait=="d_eaglycomp", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x8  if trait=="d_eaglycomp", hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x11 if trait=="d_communal" , hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x12 if trait=="d_communal" , hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x13 if trait=="d_communal" , hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x16 if trait=="dk_com", hor) ///
		   (rspike llb_allpol_std lub_allpol_std x17 if trait=="dk_com", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x18 if trait=="dk_com", hor) ///
		   (rspike llb_malpol_std lub_malpol_std x21 if trait=="dk_lea", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x22 if trait=="dk_lea", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x23 if trait=="dk_lea", hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x26 if trait=="dk_emp", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x27 if trait=="dk_emp", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x28 if trait=="dk_emp", hor) /// 
		   (rspike llb_malpol_std lub_malpol_std x31 if trait=="dk_int", hor) /// 
		   (rspike llb_allpol_std lub_allpol_std x32 if trait=="dk_int", hor) /// 
		   (rspike llb_fempol_std lub_fempol_std x33 if trait=="dk_int", hor) /// 
		   (scatter x1  l_malpol_std if trait=="d_eaglyagen", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x2  l_allpol_std if trait=="d_eaglyagen", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x3  l_fempol_std if trait=="d_eaglyagen", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x6  l_malpol_std if trait=="d_eaglycomp", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x7  l_allpol_std if trait=="d_eaglycomp", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x8  l_fempol_std if trait=="d_eaglycomp", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x11 l_malpol_std if trait=="d_communal" , mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x12 l_allpol_std if trait=="d_communal" , mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x13 l_fempol_std if trait=="d_communal" , mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
	       (scatter x16 l_malpol_std if trait=="dk_com", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x17 l_allpol_std if trait=="dk_com", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x18 l_fempol_std if trait=="dk_com", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x21 l_malpol_std if trait=="dk_lea", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x22 l_allpol_std if trait=="dk_lea", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x23 l_fempol_std if trait=="dk_lea", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x26 l_malpol_std if trait=="dk_emp", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x27 l_allpol_std if trait=="dk_emp", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x28 l_fempol_std if trait=="dk_emp", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   (scatter x31 l_malpol_std if trait=="dk_int", mlab(l_malpol_std)  mlabg(*6)  m(O) mcol(ebblue)) ///
		   (scatter x32 l_allpol_std if trait=="dk_int", mlab(l_allpol_std)  mlabg(*6)  m(T) mcol(orange)) ///
		   (scatter x33 l_fempol_std if trait=="dk_int", mlab(l_fempol_std)  mlabg(*6)  m(S) mcol(red)) ///
		   , legend(order(22 "Men politicians" 23 "Politicians" 24 "Women politicians") size(vsmall)) ylabel(-1 " " -2  "Agency                                      " -3 " " -6 " " -7 "Competence" -8 " " -11 " " -12 "Communality"  -13 " " -16 " " -17 `" "Leader" "competence" "' -18 " " -21 " " -22 `" "Strong" "leadership" "' -23 " " -26 " " -27 "Empathy"  -28 " " -31 " " -32 "Integrity" -33 " ", noticks angle(0) labs(vsmall)) yscale(alt range(1 -33)) xscale(range(-1 1)) xlabel(-1 0 1, labsize(vsmall)) xline(0, lp(dash) lc(gs14)) title(Women respondents only) name(women, replace) scheme(tufte)
restore
 
grc1leg men women, ycommon xcommon pos(6) 

* Significance test between original men respondent and women respondents scale scores
clear
global scales d_eaglyagen d_eaglycomp d_communal dk_com dk_lea dk_emp dk_int 
global groups fempol allpol malpol
gen scale = ""
gen group = ""
gen meanmen = .
gen meanwomen = .
gen semen = .
gen sewomen = .
gen t = .
gen df = .

local count = 0
foreach scale of global scales {
	di "`scale'"
	foreach group of global groups {
		local count = `count' + 1
		di `count'
		set obs `count'
		di `count'
		preserve
			use "listscalescores_US_men.dta", clear
			qui sum l_`group'_us_std if trait=="`scale'"
			local x1 = r(mean)
			qui sum lse_`group'_us_std if trait=="`scale'"	
			local se1 = r(mean)
			local n1 = 1200
			local sd1 = `se1' * (`n1'^.5)
			use "listscalescores_US_women.dta", clear
			qui sum l_`group'_us_std if trait=="`scale'"
			local x2 = r(mean)
			qui sum lse_`group'_us_std if trait=="`scale'"	
			local se2 = r(mean)
			local n2 = 1200
			local sd2 = `se2' * (`n2'^.5)
			local t = (`x1' - `x2') / (((`se1'^2) + (`se2'^2))^.5)
			local df = (`sd1'^2/`n1' + `sd2'^2/`n2')^2 / (((`sd1'^2/`n1')^2/(`n1'-1)) + ((`sd2'^2/`n2')^2/(`n2'-1))) 
		restore
		qui replace scale = "`scale'" in `count'
		qui replace group = "`group'" in `count'
		qui replace meanmen = `x1' in `count'
		qui replace meanwomen = `x2' in `count'
		qui replace semen = `se1' in `count'
		qui replace sewomen = `se2' in `count'
		qui replace t = `t' in `count'
		qui replace df = int(`df') in `count'
	}
}
gen p = ttail(df,abs(t))*2 // two-tailed test, can be compared to 0.05
format mean* se* t p %4.3f


qui replace group = "Women politicians" if group=="fempol"
qui replace group = "Politicians" if group=="allpol"
qui replace group = "Men politicians" if group=="malpol"
qui replace scale = "Agency" if scale=="d_eaglyagen"
qui replace scale = "Competence" if scale=="d_eaglycomp" 
qui replace scale = "Communality" if scale=="d_communal"
qui replace scale = "Leader competence" if scale=="dk_com"
qui replace scale = "Strong leadership" if scale=="dk_lea"
qui replace scale = "Empathy" if scale=="dk_emp"
qui replace scale = "Integrity" if scale=="dk_int"



 
 
 
 
 







****************** ****************** ****************** ****************** ****************** ****************** 
****************** Additional analysis: Subtyping analysis, like the original paper
use "listpercentages_US.dta", clear
do "traitnames.do"

* Correlations
corr l_malpol_us l_allpol_us l_men_us
corr l_fempol_us l_allpol_us l_women_us
corr l_women_us l_fempol_us l_allpol_us  l_malpol_us l_men_us

* Female politicians and women compared
local cut = 2/3
local labopts = "mlab(english) mlabs(vsmall) msym(o)"
twoway (function y=x, lp(dash) lc(gs12) range(.25 1)) ///
(scatter l_fempol_us l_women_us if (l_fempol_us>`cut' & l_women_us<`cut'), `labopts' mcol(blue)) ///
(scatter l_fempol_us l_women_us if (l_fempol_us>`cut' & l_women_us>`cut'), `labopts' mcol(black)) ///
(scatter l_fempol_us l_women_us if (l_fempol_us<`cut' & l_women_us>`cut'), `labopts' mcol(red)) ///
(scatter l_fempol_us l_women_us if (l_fempol_us<=`cut' & l_women_us<=`cut'), msym(o) msiz(small) mcol(gs12)), ///
legend(pos(6) cols(4) order(2 "Women politicians only" 4 "Women only" 3 "Both" 5 "Neither") si(vsmall)) xtitle("Trait percentage for women (list)", si(vsmall)) ytitle("Trait percentage for women politicians (list)", si(vsmall)) xlabel(.2(.2)1, labs(vsmall) tsty(minor)) ylabel(.2(.2)1, labs(vsmall) tsty(minor))	name(fempol_women, replace) aspect(1)						

* Female politicians and politicians compared
local cut = 2/3			
local labopts = "mlab(english) mlabs(vsmall) msym(o)"
twoway (function y=x, lp(dash) lc(gs12) range(.15 1)) ///
(scatter l_fempol_us l_allpol_us if (l_fempol_us>`cut' & l_allpol_us<`cut'), `labopts' mcol(blue)) ///
(scatter l_fempol_us l_allpol_us if (l_fempol_us>`cut' & l_allpol_us>`cut'), `labopts' mcol(black)) ///
(scatter l_fempol_us l_allpol_us if (l_fempol_us<`cut' & l_allpol_us>`cut'), `labopts' mcol(red)) ///
(scatter l_fempol_us l_allpol_us if (l_fempol_us<=`cut' & l_allpol_us<=`cut'), msym(o) msiz(small) mcol(gs12)), ///
legend(pos(6) cols(4) order(2 "Women politicians only" 4 "Politicians only" 3 "Both" 5 "Neither") si(vsmall)) xtitle("Trait percentage for all politicians (list)", si(vsmall)) ytitle("Trait percentage for women politicians (list)", si(vsmall)) xlabel(.2(.2)1, labs(vsmall) tsty(minor)) ylabel(.2(.2)1, labs(vsmall) tsty(minor))	name(fempol_allpol, replace) aspect(1)						

* Male politicians and Men compared
local cut = 2/3
local labopts = "mlab(english) mlabs(vsmall) msym(o)"
twoway (function y=x, lp(dash) lc(gs12) range(.25 1)) ///
(scatter l_malpol_us l_men_us if (l_malpol_us> `cut' & l_men_us<`cut'), `labopts' mcol(blue)) ///
(scatter l_malpol_us l_men_us if (l_malpol_us> `cut' & l_men_us>`cut'), `labopts' mcol(black)) ///
(scatter l_malpol_us l_men_us if (l_malpol_us< `cut' & l_men_us>`cut'), `labopts' mcol(red)) ///
(scatter l_malpol_us l_men_us if (l_malpol_us<=`cut' & l_men_us<=`cut'), msym(o) msiz(small) mcol(gs12)), ///
legend(pos(6) cols(4) order(2 "Men politicians only" 4 "Men only" 3 "Both" 5 "Neither") si(vsmall)) xtitle("Trait percentage for men (list)", si(vsmall)) ytitle("Trait percentage for men politicians (list)", si(vsmall)) xlabel(.2(.2)1, labs(vsmall) tsty(minor)) ylabel(.2(.2)1, labs(vsmall) tsty(minor))	name(malpol_men, replace) aspect(1)						

* Male politicians and politicians compared
local cut = 2/3			
local labopts = "mlab(english) mlabs(vsmall) msym(o)"
twoway (function y=x, lp(dash) lc(gs12) range(.15 1)) ///
(scatter l_malpol_us l_allpol_us if (l_malpol_us> `cut' & l_allpol_us< `cut'), `labopts' mcol(blue)) ///
(scatter l_malpol_us l_allpol_us if (l_malpol_us> `cut' & l_allpol_us> `cut'), `labopts' mcol(black)) ///
(scatter l_malpol_us l_allpol_us if (l_malpol_us< `cut' & l_allpol_us> `cut'), `labopts' mcol(red)) ///
(scatter l_malpol_us l_allpol_us if (l_malpol_us<=`cut' & l_allpol_us<=`cut'), msym(o) msiz(small) mcol(gs12)), ///
legend(pos(6) cols(4) order(2 "Men politicians only" 4 "Politicians only" 3 "Both" 5 "Neither") si(vsmall)) xtitle("Trait percentage for all politicians (list)", si(vsmall)) ytitle("Trait percentage for men politicians (list)", si(vsmall)) xlabel(.2(.2)1, labs(vsmall) tsty(minor)) ylabel(.2(.2)1, labs(vsmall) tsty(minor))	name(malpol_allpol, replace) aspect(1)						




